//package com.kania.simpleemail.core;
//
//import java.util.Properties;
//
//import javax.mail.Authenticator;
//import javax.mail.Folder;
//import javax.mail.MessagingException;
//import javax.mail.Session;
//import javax.mail.Store;
//
//import android.util.Log;
//
//public class POP3 implements IMailReceiver {
//	private String sHost;
//	private String sID;
//	private String sPassword;
//	
//	private Store store;
//	private Folder folder;
//	
//	private final String STRING_POP3_NAME = "pop3";
//	private final String STRING_POP3_SSL_PORT = "993";
//	private final String STRING_SOCKETFACTORY_NAME = "javax.net.ssl.SSLSocketFactory";
//	private final String STRING_SECURED_POP3_NAME = "pop3s";
//	private final String STRING_DEFAULT_INBOX_NAME = "INBOX";	
//
//	public POP3(String _host, String _id, String _password) {
//		sHost = _host;
//		sID = _id;
//		sPassword = _password;
//	}
//	
//	@Override
//	public void open()
//			throws MessagingException {
//		Properties props = new Properties();
//		
//		props.put("mail.transport", STRING_POP3_NAME);
//		props.put("mail.pop.host", sHost);
//		props.put("mail.pop.port", STRING_POP3_SSL_PORT);
//		props.put("mail.pop.starttls.enable", "true");
//		props.put("mail.pop.socketFactory.class", STRING_SOCKETFACTORY_NAME); 
//		props.put("mail.pop.auth", "true");
//		
//		Log.d("KANIA_LOG_LIST", "In POP3 Auth = " + sID + " / " + sPassword);
//		Authenticator auth = new MailAutentication(sID, sPassword);
//		Session mailSession = Session.getDefaultInstance(props,auth);
//		
//		try {
//			store = mailSession.getStore(STRING_SECURED_POP3_NAME);
//			store.connect(sHost, sID, sPassword);
//			
//			folder = store.getFolder(STRING_DEFAULT_INBOX_NAME);
//			folder.open(Folder.READ_ONLY);
//		} catch (Exception e) {
//			Log.e("KANIA_LOG_CORE", "error in getting Store object");
//			throw new MessagingException("error in store and folder");
//		}
//		
//		Log.d("KANIA_LOG_CORE", "Success opening session");
//	}
//
//	@Override
//	public void close() throws MessagingException {
//		if (folder != null && folder.isOpen() == true) {
//			folder.close(true);
//		}
//		if (store != null && store.isConnected() == true) {
//			store.close();
//		}
//		
//		Log.d("KANIA_LOG_CORE", "Success closing session");
//	}
//
//	@Override
//	public Store getStore() throws MessagingException {
//		if (store.isConnected() == false) {
//			throw new MessagingException("Already closed store");
//		}
//		return store;
//	}
//
//	@Override
//	public Folder getFolder() throws MessagingException {
//		if (folder.isOpen() == false) {
//			throw new MessagingException("Already closed folder");
//		}
//		return folder;
//	}
//	
//
//}
